package cc.wfu.type.service;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.UUID;


/**
 * @Author: jia-qiang ljq1024.cc
 * @desc: SpringSecurity 查询用户信息实现类
 * @Date: 2024-05-21-16:46
 */
@Service
public interface UserDetailsServiceStrategy extends UserDetailsService {

    @Override
    default UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        String password = UUID.randomUUID().toString();
        System.out.println();
        System.out.println(("security default password is: " + password));
        System.out.println();
        return User.withUsername(username)
                .authorities("ROLE_anonymousUser")
                .password(password)
                .build();
    }
}
